//===========================================================================
//
//  File Name:    Setup.rul
//
//  Description:  Blank setup main script file
//
//  Comments:     Blank setup is an empty setup project. If you want to
//				  create a new project via. step-by step instructions use the
//				  Project Assistant.
//
//===========================================================================

// Included header files ----------------------------------------------------
#include "ifx.h"

// Note: In order to have your InstallScript function executed as a custom
// action by the Windows Installer, it must be prototyped as an 
// entry-point function.

// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.
    
/* export prototype MyFunction(HWND); */
//export prototype SetUILevel(HWND);

/*
function OnBegin()
begin
	if (MODE = SILENTMODE) then
		//MessageBox("SetUILevel - SILENTMODE", INFORMATION);
		SilentWriteData("INIT", "TEST", DATA_STRING, "aho", 0);
	else  
		MessageBox("SetUILevel - NORMALMODE", INFORMATION);
	endif;
end;
*/

/*                   
function SetUILevel(hInstance)
begin
	if (MODE = SILENTMODE ) then
		MsiSetProperty(hInstance, "UILevel", "2");
	else
		MsiSetProperty(hInstance, "UILevel", "5");
	endif;
end;
*/	
                      
function OnFirstUIBefore() 
	number nResult, nSetupType, nvSize;
begin                               

	nSetupType = COMPLETE;

Dlg_Start:     
	// Beginning of dialogs label
	  
Dlg_SdWelcome:
	nResult = SdWelcome("", "");
	if (nResult = BACK) goto Dlg_Start;

Dlg_SdLicense:
	nResult = SdLicense2Rtf("", "", "", "License.rtf", FALSE);
	if (nResult = BACK) goto Dlg_SdWelcome;

/*
if ( MODE = NORMALMODE ) then                           
Dlg_SdAskDestPath:
	nResult = SdAskDestPath("", "", INSTALLDIR, 0);
	if (nResult = BACK) goto Dlg_SdLicense;
endif;
*/

/*
Dlg_SetupType:    
    nResult = SetupType2("", "", "", nSetupType, 0);
    if (nResult = BACK) goto Dlg_SdAskDestPath;
    nSetupType = nResult;

Dlg_SdFeatureTree: 
	if (nSetupType = CUSTOM) then
		nResult = SdFeatureTree("", "", INSTALLDIR, "", 2);
		if (nResult = BACK) goto Dlg_SetupType;
	endif;
*/

Dlbg_SdStartCopy2:
	nResult = SdStartCopy2("", "");
	if (nResult = BACK) goto Dlg_SdLicense;
	
	Enable(STATUSEX);
end;

function OnMaintUIBefore()
    NUMBER nResult, nType;
begin
	if (MODE = SILENTMODE) then   
		nType = REPAIR;
	else 
		if (ADDREMOVE) then
			if (REMOVEONLY) then
				nType = REMOVEALL;
			else
				nType = REPAIR;
			endif;
/*		else
			Disable(BACKBUTTON);
	  		nType = SdWelcomeMaint("", "", REMOVEALL);
 	 		Enable(BACKBUTTON);  
*/
 	 	endif;
	endif;
	
	if (nType = REMOVEALL) then 
		FeatureRemoveAll();
	else
		FeatureReinstall();
	endif;
			    
    Enable(STATUSEX);
end;

